package com.zhang.teachingcommunity_spring.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhang.teachingcommunity_spring.mapper.SubjectMapper;
import com.zhang.teachingcommunity_spring.mapper.entity.Subject;
import com.zhang.teachingcommunity_spring.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/subject")
public class SubjectController {
    @Autowired
    private SubjectMapper subjectMapper;
    @GetMapping("/findAll")
    private Result findAll() {
        QueryWrapper<Subject> subjectQueryWrapper = new QueryWrapper<>();
        List<Subject> subjects = subjectMapper.selectList(subjectQueryWrapper);
        return Result.success("获取成功", subjects);
    }
}
